package com.zhongzhi.util;

import java.io.Serializable;

import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class JsonResult implements Serializable{

	/**
	 * controller向视图层传递
	 */
	private static final long serialVersionUID = -5327090041711112618L;

	private Integer code =200;
	private String message = "执行成功";
	private String info = "执行成功";
	private Integer size = 0;
	private Object data =null;
	
	public JsonResult(String message,Integer code) {
		this.code = code;
		this.info = message;
		this.message=message;
	}
	public JsonResult(Throwable e) {
		this.code = 500;
		this.info = e.getMessage();
		this.message=e.getMessage();
	}
	public JsonResult(Object data,Integer code) {
		this.code = code;
		this.data = data;
	}
	public JsonResult(Integer code, String message, Integer size, Object data) {
		super();
		this.code = code;
		this.message = message;
		this.info = message;
		this.size = size;
		this.data = data;
	}
	public JsonResult(Integer code, String message, Object data) {
		super();
		this.code = code;
		this.message = message;
		this.info = message;
		this.data = data;
	}
	@Override
	public String toString() {
		return "JsonResult [code=" + code + ", message=" + message + ", info=" + info + ", size=" + size + ", data="
				+ data + "]";
	}
	
	
	
}
